Skip to content

Durga-css-basics#521

Open
Saidurgasatturi wants to merge 4 commits intoaptyInc:mainfrom
Saidurgasatturi:durga-css-basics
Open

Durga-css-basics#521
Saidurgasatturi wants to merge 4 commits intoaptyInc:mainfrom
Saidurgasatturi:durga-css-basics

Conversation

@Saidurgasatturi
Copy link
Copy Markdown

@Saidurgasatturi Saidurgasatturi commented Sep 30, 2025

Terms and Conditions

  • I Accept losing points if my PR does not follow the best practices mentioned below, which will impact my overall performance in training

HTML Best Practices

  • File Naming Convention:

  • Follow consistent and descriptive naming (e.g., dashboard.html, user-profile.html).

  • Use lowercase letters and hyphens instead of spaces.

  • Page Title:

  • Ensure the <title> tag is descriptive and aligns with the page content.

  • Include meaningful keywords for SEO if applicable.

  • Semantic Markup:

  • Use appropriate tags like <header>, <footer>, <section>, <article> for better readability and accessibility.

  • Accessibility Standards:

  • Ensure the use of alt attributes for images and proper labels for form elements.

  • Use ARIA roles where necessary.

  • Validation:

  • Ensure the code passes HTML validation tools without errors or warnings.

  • Structure and Indentation:

  • Maintain consistent indentation and proper nesting of tags.

  • Attributes:

  • Ensure all required attributes (e.g., src, href, type, etc.) are correctly used and not left empty.

CSS Best Practices

  • File Organization:

  • Use modular CSS files if applicable (e.g., base.css, layout.css, theme.css).

  • Avoid inline styles unless absolutely necessary.

  • Naming Conventions:

  • Use meaningful class names following BEM or other conventions (e.g., block__element--modifier).

  • Code Reusability:

  • Avoid duplicate code; use classes or mixins for shared styles.

  • Responsive Design:

  • Ensure proper usage of media queries for mobile, tablet, and desktop views.

  • Performance Optimization:

  • Minimize the use of unnecessary CSS selectors.

  • Avoid overly specific selectors and ensure selectors are not overly deep (e.g., avoid #id .class1 .class2 p).

  • Consistency:

  • Follow consistent spacing, indentation, and use of units (rem/em vs. px).

  • Maintain a single coding style (e.g., always use double or single quotes consistently).

Javascript Best Practices

  • File Organization:

  • Ensure scripts are modular and logically separated into files if needed.

  • Avoid mixing inline JavaScript with HTML.

  • Logic Optimization:

  • Check for redundancy and ensure the code is optimized for performance.

  • Avoid unnecessary API calls or DOM manipulations.

  • Solution Approach:

  • Confirm that the code solves the given problem efficiently.

  • Consider scalability for future enhancements.

  • Readability:

  • Use clear variable and function names.

  • Add comments for complex logic or algorithms.

  • Error Handling:

  • Ensure proper error handling for API calls or user input validation.

  • Code Quality:

  • Check for potential bugs (e.g., missing await, mishandling of null/undefined values).

  • Avoid unnecessary console.log statements in production code.

  • Security:

  • Avoid hardcoding sensitive data.

  • Sanitize user input to prevent XSS and other vulnerabilities.

  • Best Practices:

  • Use const and let instead of var.

  • Follow ES6+ standards where applicable.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @Saidurgasatturi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a series of foundational CSS assignments, designed to illustrate various styling techniques and layout patterns in web development. It covers the application of inline, internal, and external CSS, demonstrates responsive design for different devices, and builds a component-based layout for a team gallery. Additionally, a VS Code launch configuration is included to aid in local development and testing of these new web pages.

Highlights

  • New VS Code Launch Configuration: A new .vscode/launch.json file has been added to facilitate launching a Chrome browser against a local development server, streamlining the setup for local testing.
  • CSS Basics - Assignment 1: Basic Webpage: Introduced basic_webpage.html and style.css to demonstrate the three primary methods of applying CSS: inline, internal (within <style> tags), and external (linked style.css).
  • CSS Basics - Assignment 2: Recipe Page: Added recipe.html, showcasing a styled recipe page using internal CSS, including responsive design principles with media queries for different screen sizes.
  • CSS Basics - Assignment 3: Team Gallery: Implemented team_gallery.html and its corresponding style.css to create a responsive team member gallery with profile cards, hover effects, and structured layout.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds three assignments covering CSS basics. The code demonstrates a foundational understanding of CSS properties, selectors, and responsive design. My review focuses on improving the code by adhering more closely to the best practices outlined in the pull request description and general web development standards. Key areas for improvement include moving internal styles to external stylesheets, using more semantic HTML for better structure and accessibility, refining CSS selectors for maintainability, and correcting accessibility issues with image alt attributes. Adopting modern layout techniques like Flexbox is also suggested for more robust and flexible designs.

Comment on lines +9 to +105
<style>

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: Arial, sans-serif;
line-height: 1.6;
background-color: #fafafa;
color: #333;
}

section {
margin: 10px auto;
width: 90%;
max-width: 900px;
border-radius: 15px;
padding: 20px;
}
#recipe-name {
background-color: #e63946;
color: white;
text-align: center;
padding: 30px 20px;
font-size: 42px;
font-weight: bold;
letter-spacing: 1px;
border-radius: 12px;
margin-top: 20px;
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#ingredients {
background-color: #d4edda;
}

#ingredients h2 {
margin-bottom: 15px;
color: #155724;
font-size: 26px;
}

#ingredients ul {
list-style-type: disc;
margin-left: 20px;
font-size: 18px;
line-height: 1.8;
}
#steps {
background-color: #fff3cd;
}

#steps h2 {
margin-bottom: 15px;
color: #856404;
font-size: 26px;
}

#steps ol {
margin-left: 20px;
font-size: 18px;
line-height: 1.9;
}
#dish-image {
background-color: #f8f9fa;
text-align: center;
}

#dish-image img {
max-width: 100%;
height: auto;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.25);
margin-bottom: 10px;
}

#dish-image p {
font-style: italic;
font-size: 16px;
color: #555;
}

@media (max-width: 600px) {
#recipe-name {
font-size: 28px;
padding: 20px;
}
#ingredients ul, #steps ol {
font-size: 16px;
}
section {
padding: 15px;
}
}
</style>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Per the best practices in the PR description, CSS should be organized into modular, external files. Placing all of this CSS into a separate file (e.g., recipe.css) and linking it in the <head> with <link rel="stylesheet" href="recipe.css"> will improve separation of concerns, make the code more maintainable, and allow browsers to cache the stylesheet.

Comment on lines +108 to +110
<section id="recipe-name">
Delicious Chocolate Cake
</section>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The main title of the page, "Delicious Chocolate Cake", is placed directly within a <section> tag as plain text. For semantic correctness and accessibility, it should be wrapped in an <h1> tag. Heading tags are crucial for screen readers and search engines to understand the document's structure.

Suggested change
<section id="recipe-name">
Delicious Chocolate Cake
</section>
<section id="recipe-name">
<h1>Delicious Chocolate Cake</h1>
</section>



<div class="profile-card">
<img src="profilecard_1.jpg" alt="John Doe" class="profile-pic">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The alt text "John Doe" does not match the team member's name, "Sai". For accessibility, the alt text for a profile picture should be the person's name to provide equivalent information to users of screen readers.

Suggested change
<img src="profilecard_1.jpg" alt="John Doe" class="profile-pic">
<img src="profilecard_1.jpg" alt="Sai" class="profile-pic">

</div>

<div class="profile-card">
<img src="profilecard_2.webp" alt="Jane Smith" class="profile-pic">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The alt text "Jane Smith" does not match the team member's name, "Durga". For accessibility, the alt text for a profile picture should be the person's name to provide equivalent information to users of screen readers.

Suggested change
<img src="profilecard_2.webp" alt="Jane Smith" class="profile-pic">
<img src="profilecard_2.webp" alt="Durga" class="profile-pic">

</div>

<div class="profile-card">
<img src="mypicture.jpg" alt="Mike Lee" class="profile-pic">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The alt text "Mike Lee" does not match the team member's name, "Sai Durga". For accessibility, the alt text for a profile picture should be the person's name to provide equivalent information to users of screen readers.

Suggested change
<img src="mypicture.jpg" alt="Mike Lee" class="profile-pic">
<img src="mypicture.jpg" alt="Sai Durga" class="profile-pic">

Comment on lines +18 to +22
.container {
background-color: #f5f5f5;
padding: 20px;
align-items: center;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The align-items: center; property is ineffective here because it only applies to flex containers (display: flex or inline-flex). Since .container is a standard block element, this property has no effect. The text and image content within are already being centered by other means, so this line can be safely removed.

Suggested change
.container {
background-color: #f5f5f5;
padding: 20px;
align-items: center;
}
.container {
background-color: #f5f5f5;
padding: 20px;
}

margin-bottom: 15px;
}

ul li {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ul li selector is too generic and will style every list item inside any unordered list across the entire site. This can lead to unintended side effects and styling conflicts. It's a best practice to scope selectors to the specific component they are intended for, for instance, by prefixing it with a parent class like .container.

Suggested change
ul li {
.container ul li {

border-radius: 15px;
padding: 20px;
}
#recipe-name {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using IDs for styling (like #recipe-name) leads to high specificity, which can make your CSS difficult to override and maintain. It's a best practice to use classes for styling to create more reusable and scalable stylesheets. If you change this to a class selector (.recipe-name), remember to also update the HTML from id="recipe-name" to class="recipe-name".

Suggested change
#recipe-name {
.recipe-name {

Comment on lines +101 to +103
section {
padding: 15px;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The section selector in this media query is too broad and will apply to all <section> elements, overriding their individual padding settings on smaller screens. For example, it reduces the padding on the #recipe-name section. To avoid such unintended consequences, use more specific selectors or a shared class for sections that require this responsive padding adjustment.

Comment on lines +25 to +36
.profile-card {
display: inline-block;
width: 280px;
margin: 15px;
padding: 15px;
border: 2px solid #ddd;
border-radius: 10px;
background-color: #fafafa;
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.187);
vertical-align: top;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

You're using display: inline-block to create the gallery layout. A more modern and flexible approach is to use Flexbox. By applying display: flex, flex-wrap: wrap, and justify-content: center to the parent .team-container, you can achieve a more robust layout. This also allows you to use the gap property for spacing, which can simplify the CSS for .profile-card by removing the need for margin and vertical-align.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant